package com.yourname.projectname.controller.user;


import com.yourname.projectname.dto.user.UserLoginDTO;
import com.yourname.projectname.dto.user.UserRegisterDTO;
import com.yourname.projectname.result.Result;
import com.yourname.projectname.service.user.UserAuthService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * 用户登录相关控制器
 */
@RestController
public class UserAuthController {

    @Resource
    private UserAuthService userAuthService;


    /**
     * 用户登录
     * @param userLoginDTO
     * @return
     */
    @PostMapping("/user/login")
    public Result login(UserLoginDTO userLoginDTO) {
        return userAuthService.login(userLoginDTO);
    }

    /**
     * 用户退出登录
     * @return
     */
    @PostMapping("/user/logout")
    public Result logout() {
        return userAuthService.logout();
    }

    @PostMapping("/user/register")
    public Result register(UserRegisterDTO userRegisterDTO) {
        return userAuthService.register(userRegisterDTO);
    }


}
